package com.itheimatest;
import java.util.Random;
public class Demo01 {
    public static void main(String[] args) {
        Random r = new Random();
        int[] arr = new int[6];
        int max = arr[0];
        int sum = 0;
        int min = arr[0];
        System.out.println(min);
        System.out.println(max);
        System.out.println("数组中的数据为:");
        for (int i = 0; i < arr.length; i++) {
            arr[i] = r.nextInt(10) + 1;
            sum += arr[i];
            System.out.print(arr[i] + " ");
        }
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        for (int i = 0; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        System.out.println("最大值为:" + max);
        System.out.println("最小值为:" + min);
        System.out.println("平均数为:" + ((sum - min - max) / (arr.length - 2)));
    }

}
